function addFun(){
	showWindow({
		title:"创建讨论组",
		width:530,
		height:400,
		cache:false,
		content:$("#disMain").html()
	});
	$("#disMain").remove();
}

function addAlreadyUser(){
	var len = $("#MyPopWindow #alreadyUserId option").length;
	var obj = $("#MyPopWindow #alreadyUserId");
	var op = $("#MyPopWindow #onLineUserId").find("option:selected");
	for (var i = 0; i < len; i++) { 
		option_value = obj[0].options[i].value;
		if(op.val() == option_value){
			return;
		}
	} 
	
	$("#MyPopWindow #alreadyUserId").append(op.clone());
}
function removeAlreadyUser(){
	$("#MyPopWindow #alreadyUserId").find("option:selected").remove();
}
function addDiscussion(){
	var len = $("#MyPopWindow #alreadyUserId option").length;
	if(len<=0)
		return;
	var obj = $("#MyPopWindow #alreadyUserId");
	var userArr=[];
	var userIds = "";
	var title = "";
	for (var i = 0; i < len; i++) { 
		title += obj[0].options[i].text+",";
		userIds += obj[0].options[i].value+"_";
		userArr.push({"userName":obj[0].options[i].text,"userId":obj[0].options[i].value});
	} 
	title = title.substring(0,title.length-1);
	//userIds = userIds.substring(0,userIds.length-1);
	
	closeWindow();
	$("#MyPopWindow #alreadyUserId option").remove();
	$("#disc").show();
	if ($('#disc').tabs('exists', title)){
        $('#disc').tabs('select', title);
    } else {
		$('#disc').tabs('add',{
			title:title,
			closable:true,
			cache:false,
			content:"<div id='group_"+userIds+"' class='easyui-layout' data-options='fit:true'></div>"
		});
		$('#disc').tabs('select', title);
    }
     var optionsWest = {
		region: "west",
		width: 214,
		cache:false
	};
	$("#group_"+userIds).layout('add', optionsWest);
    var optionsCenter = {
		region: "center",
		cache:false,
		content:"<div id='"+userIds+"' class='easyui-layout' data-options='fit:true' style='height:100%'></div>"
	};
	$("#group_"+userIds).layout('add', optionsCenter);
	var optionsCenter1 = {
		region: "center",
		content:"",
		cache:false
	};
	$("#"+userIds).layout('add', optionsCenter1);
	var optionsSouth1 = {
		region: "south",
		cache:false,
		height: 236,
		content:"<div style='float:left'><textarea rows='5' cols='100' style='height:196px'></textarea></div><div style='float:right;padding-top:15px;padding-right:15px;'><input type='button' style='width:150;height:170' value='发送'/></div>"
	};
	$("#"+userIds).layout('add', optionsSouth1);
}